import { LangType } from "../tools/Define";
import LangManager from "./LangManager";
const {ccclass, property} = cc._decorator;

@ccclass
export default abstract class LangComponent extends cc.Component {


    @property
    langID: string = '';

    @property({type:cc.Enum(LangType)})
    localType: LangType = LangType.STRING;

    start(){
        if(this.langID){
            switch(this.localType){
                case LangType.STRING:
                    this.getLangManager().setLocalString(this,this.langID)
                break;
                case LangType.SPRITE:
                    this.getLangManager().setLocalSprite(this,this.langID)
                break;
                case LangType.BUTTON:
                    this.getLangManager().setLocalButton(this,this.langID)
                break;                                
            }
        }
    }


    abstract getLangManager():LangManager;
}
